package com.hgq.jssjyyxt.entity;

import java.math.BigDecimal;
import java.text.ParseException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.io.Serializable;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.hgq.jssjyyxt.util.DateUtil;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * (Courses)实体类
 *
 * @author makejava
 * @since 2024-04-11 13:53:37
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Courses implements Serializable {
    private static final long serialVersionUID = 202296249793820674L;
    /**
     * 课程表id
     */
    @TableId(type = IdType.AUTO)
    private Integer courseId;
    /**
     * 私教id
     */
    private Integer trainerId;
    /**
     * 课程标题
     */
    private String title;
    /**
     * 优势介绍
     */
    private String description;
    /**
     * 最多参与人数
     */
    private Integer maxParticipants;
    /**
     * 开始时间
     */
    private Date startTime;
    /**
     * 结束时间
     */
    private Date endTime;
    /**
     * 课程地点
     */
    private String location;
    /**
     * 课程时长
     */
    private String duration;
    /**
     * 课程类型
     */
    private Integer courseType;
    /**
     * 主图
     */
    private String img;
    /**
     * 价格
     */
    private BigDecimal price;
    /**
     * 1待发布2已发布3已停止
     */
    private Integer state;
    @TableField(exist = false)
    private String trainerName;
    @TableField(exist = false)
    private String gender;
    @TableField(exist = false)
    private Integer level;
    @TableField(exist = false)
    private Integer userId;
    @TableField(exist = false)
    private Integer status;


    public void setEndTime(String endTimeStr) throws ParseException {
        this.endTime = DateUtil.formatTime(endTimeStr);
    }

    public void setStartTime(String startTimeStr) throws ParseException {
        this.startTime =  DateUtil.formatTime(startTimeStr);
    }
}

